function check(){
	if(form.oid.value==""){
		alert("社团编号不能为空！");
		form.oid.focus();
		return false;
	}
	if(form.oname.value==""){
		alert("社团名字不能为空！");
		form.oname.focus();
		return false;
	}
	var regm=/^[a-z0-9]+$/;
	if(form.oname.value!=""&&!form.oname.value.match(regm)){
		alert("社团名字格式不对，社团名字只能由小写字母与数字组成，检查后重新输入！");
		form.oname.focus();
		return false;
	}
}

function createXmlHttpRequest(){
    var xmlreq = false;
    if (window.XMLHttpRequest){
        xmlreq = new XMLHttpRequest();
    }else
        if (window.ActiveXObject){
    	try{
    	    xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
    	}catch(e1){
    	    try{
    	        xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
    	    }catch(e2){
    	}
         }
    }
    return xmlreq;   	
}

function oNameCheck(){
    var request = createXmlHttpRequest();
    var oname = document.all.oname.value;
    request.open("post","onameCheckServlet?oname="+oname);
    request.send();
    request.onreadystatechange = function(){
	if(request.readyState==4){
	        var value = request.responseText;
	        if(value=="true"){
	                document.all.oname.value="该社团名字已存在";
	        }
    	}
    }
}

